program define plot_IRF
	
	args var_name output_folder output_name
	
	if "`output_folder'" == "" local output_folder "."
	if "`output_name'" == "" local output_name "`var_name'_IRF"
	
	tempvar zero 
	
	gen `zero' = 0
	svmat `output_name', names(matcol)
	
	graph twoway (rarea `var_name'lb `var_name'ub `var_name'lag, color(ltblue)) ///
		(line `var_name'IRF `var_name'lag, lcolor(red) lwidth(medthick)) ///
		(line `zero' `var_name'lag, lcolor(gs5) lpattern(dash)), ///
			legend(off) xtitle(Lag) ytitle(Impulse Response)
	
	graph export `output_folder'/`output_name'.pdf, replace 
	
	drop `var_name'lag `var_name'IRF `var_name'se ///
	     `var_name'lb `var_name'ub `var_name'df_resid `var_name'K

end 
